<template>
	<view  class="tabInfo">
		<!-- #4A43EC  -->
			<view @click="toPage(item,index)" v-for="(item,index) in tabs" :style="{'color' : index == i ? '#4A43EC' : '#D5D7DC' }" >
				<u-icon :color="index == i ? '#4A43EC' : '#D5D7DC'" size="40" :name="item.icon"></u-icon>
				<text>{{item.text}}</text>
			</view>
	</view>
</template>

<script>
	export default {
		name:"tabbar",
		props:{
			i: {
			      type: Number,
			      required: true
			    }
		},
		data() {
			return {
				tabs:[
					{
						icon:'home-fill',
						text:'球场',
						url:'/pages/index/index'
					},
					{
						icon:'home-fill',
						text:'球局',
						url:'/pages/ballGame/ballGame'
					},{
						icon:'home-fill',
						text:'我的',
						url:'/subpkg/me/me'
					}
				]
			};
		},
			
		methods:{
			// 跳转页面
			toPage(item,index){
				// 不在本页面就跳转
				if(index != this.i){
					uni.redirectTo({
						url:item.url
					})
				}
				
			}
		}
	}
</script>

<style>
.tabInfo{
		text-align: center;
		position: fixed;
		top: 90%;
		left: 10%;
		display: flex;
		justify-content: space-around;
		align-items: center;
		width: 80%;
		height: 130rpx;
		border-radius: 40rpx;
		opacity: 1;
		background: #FFFFFF;
		box-shadow: 8px 11px 20px 0px rgba(198, 198, 198, 0.33);
	}
</style>